turtles-here

 

Turtles-here returns the agentset of all the turtles on the caller’s patch, including itself if the caller is a turtle. For example, `

create-turtles 3 
ask turtles [ show count turtles-here ]

would return 3. You can also specify a breed by using <breed>-here; if there were some cats and mice in a model together, ask cats [ if any? mice-here [ chase ] ] would make a cat chase the mice if they are on the same patch.

 

Try it Yourself

 
 
 
 
 
 
 

What's next?

Once you mastered the turtles-here primitive, don't stop there. Check out the resources below to improve your NetLogo skills.

 
Published NetLogo models that use the turtles-here primitive:
 
 
Similar primitives:
count

Count the number of agents in an agentset.

Read more
neighbors

reports an agentset containing eight neighboring patches

Read more
patches

Address all patches of a model.

Read more
other

reports an agentset which is the same as the input agentset but omits the agent who is asking for the report

Read more
 
Learn another primitive